# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-django-webpack-loader
#_pkgreal is used by apkbuild-pypi to find modules at PyPI
_pkgreal=django-webpack-loader
pkgver=3.1.0
pkgrel=1
pkgdesc="Transparently use webpack with django"
url="https://pypi.python.org/project/django-webpack-loader"
arch="noarch"
license="MIT"
depends="py3-django"
checkdepends="
	npm
	py3-pytest
	py3-coverage
	py3-coveralls
	py3-django-jinja
"
makedepends="py3-setuptools py3-gpep517 py3-wheel"
source="$pkgname-$pkgver.tar.gz::https://github.com/django-webpack/django-webpack-loader/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/$_pkgreal-$pkgver"
subpackages="$pkgname-pyc"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	cd tests
	npm ci
	"$builddir"/.testenv/bin/python3 -m coverage run --source=webpack_loader manage.py test
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
8779ef979256aac82ad1d3ee8248f2e6ddfad41b50fc23a79fbbed7866c6ef81b7be03aa6a4b5203a1e3e43355d0e27bb197fe7e40a2e1b3cadf19212ff69c3a  py3-django-webpack-loader-3.1.0.tar.gz
"
